<link rel="stylesheet" href="__CDN__/assets/element-ui-2.15.14/css/index.css">
<link rel="stylesheet" href="__CDN__/assets/css/vvv.css">
<style>
    .el-form-item__label {
        width: 120px !important;
    }

    .el-tag + .el-tag {
        margin-left: 10px;
    }

    .button-new-tag {
        margin-left: 10px;
        height: 32px;
        line-height: 30px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .input-new-tag {
        width: 90px;
        margin-left: 10px;
        vertical-align: bottom;
    }

    input[type="file"] {
        display: none !important;
    }

    .el-form-item__error {
        margin-left: 30px;
    }

    .search-select .el-input--suffix .el-input__inner {
        width: 130px;
    }

    .layui-layer-title {
        background: #605ca8 !important;
    }
</style>
<div id="vue" v-cloak>
    <div class="screen-container">
        <div class="screen-container-show">
            <div class="screen-container-left display-flex">
                <el-button size="small" @click="refreshPage" icon="el-icon-refresh" circle type="primary"></el-button>
                <div class="datetime">
                    <el-date-picker
                            v-model="search.startTime"
                            type="datetime"
                            placeholder="选择起始时间">
                    </el-date-picker>
                </div>
                <div class="datetime">
                    <el-date-picker
                            v-model="search.endTime"
                            type="datetime"
                            placeholder="选择结束时间">
                    </el-date-picker>
                </div>
            </div>
            <div class="search-select screen-container-right display-flex keyword">
                <el-select v-model="search.status" filterable @clear="handleClearSelect('status')" clearable placeholder="请选择状态">
                    <el-option
                            v-for="item in statusOpt"
                            :key="item.id"
                            :label="item.value"
                            :value="item.id">
                    </el-option>
                </el-select>
            </div>
            <div class="search-select screen-container-right display-flex keyword v-key">
                <el-input @clear="handleClearSearchInp" clearable v-model="search.keyword" placeholder="请输入您要搜索的内容">
                    <el-select v-model="search.type" slot="prepend" placeholder="请选择">
                        <el-option v-for="(item, index) in searchOpt" :label="item.value"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                    <el-button slot="append" @click="searchData" icon="el-icon-search"></el-button>
                </el-input>
            </div>
            <div class="screen-container-right display-flex keyword">
                <el-button @click="add" size="small" type="primary" plain icon="el-icon-plus">添加
                </el-button>
                <el-button icon="el-icon-delete" type="danger" @click="del" size="small" plain>删除</el-button>
            </div>
        </div>
    </div>
    <div class="vue-table background-white color-666">
        <el-table :data="tableData" border highlight-current-row v-loading="listLoading"
                  @sort-change="sortChange" element-loading-text="拼命加载中..."
                  @selection-change="handleSelectionChange" style="width: 100%">
            <el-table-column type="selection" width="60" align="center"></el-table-column>
            <el-table-column width="120" label="操作"
                             show-overflow-tooltip
                             align="center">
                <template scope="scope">
                    <el-dropdown trigger="click">
                        <el-button size="small" plain type="primary">
                            操作<i class="el-icon-arrow-down el-icon--right"></i>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item>
                                <el-button size="small" @click="edit(scope.row.id)" type="primary" icon="el-icon-edit">编辑</el-button>
                            </el-dropdown-item>
                            <el-dropdown-item>
                                <el-button size="small"  @click="dell(scope.row.id)" type="danger" icon="el-icon-delete">删除</el-button>
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </el-table-column>
<!--            <el-table-column prop="id" width="70" label="ID" show-overflow-tooltip-->
<!--                             align="center"></el-table-column>-->
            <el-table-column prop="title" width="200" label="标题" show-overflow-tooltip
                             align="center"></el-table-column>
            <el-table-column prop="image" label="封面" width="100" align="center">
                <template scope="scope">
                    <a :href="scope.row.image" target="_blank">
                        <img :src="scope.row.image" style="border-radius: 10px;width: 60px;height: 60px;padding: 5px">
                    </a>
                </template>
            </el-table-column>
            <el-table-column width="220" prop="desc" label="简介" show-overflow-tooltip
                             align="center"></el-table-column>
            <el-table-column prop="views" width="100" label="浏览量" show-overflow-tooltip
                             align="center"></el-table-column>
            <el-table-column prop="play_num" width="100" label="播放量" show-overflow-tooltip
                             align="center"></el-table-column>
            <el-table-column prop="sort" width="100" label="排序" show-overflow-tooltip
                             align="center"></el-table-column>
            <el-table-column prop="status" width="120" label="状态" show-overflow-tooltip
                             align="center">
                <template scope="scope">
                    <el-switch
                            v-model="scope.row.status"
                            :active-value="1"
                            :inactive-value="2"
                            @change="statusChange(scope.row)"
                    >
                    </el-switch>
                </template>
            </el-table-column>
            <el-table-column prop="create_time" width="160" :formatter="dateFormat" label="创建时间" show-overflow-tooltip
                             align="center"></el-table-column>
        </el-table>
        <div class="layout-pagination">
            <el-pagination
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 50, 100]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="totalCount">
            </el-pagination>
        </div>
    </div>
</div>

<script src="__CDN__/assets/element-ui-2.15.14/js/vue.js"></script>
<script src="__CDN__/assets/element-ui-2.15.14/js/index.js"></script>
<script src="__CDN__/assets/tool/libs/moment.js"></script>
<script src="__CDN__/assets/js/jquery-2.1.1.min.js"></script>
<script src="__CDN__/assets/layer/layer.js"></script>